import api from '@/http/index';

class Api {
  /* 获取表格列表 */
  static getTablesList(data) {
    return new Promise((resolve, reject) => {
      api
        .get('/api/ModelDetail/GetGridJson', data)
        .then(res => {
          resolve(res);
        })
        .catch(err => {
          reject(err);
        });
    });
  }
  /* 新建 */
  static addTablesItem(data) {
    return new Promise((resolve, reject) => {
      api
        .post('/api/ModelDetail/SubmitForm', data)
        .then(res => {
          resolve(res);
        })
        .catch(err => {
          reject(err);
        });
    });
  }
  static getContent(data) {
    return new Promise((resolve, reject) => {
      api
        .get('/api/Products/GetGridJson', data)
        .then(res => {
          resolve(res);
        })
        .catch(err => {
          reject(err);
        });
    });
  }
  /* 停用启用 */
  static setDisableEnable(data) {
    return new Promise((resolve, reject) => {
      api
        .post('/api/Brand/Activite', data)
        .then(res => {
          resolve(res);
        })
        .catch(err => {
          reject(err);
        });
    });
  }
  /* 删除 */
  static deleteItem(data) {
    return new Promise((resolve, reject) => {
      api
        .get('/api/ModelDetail/DeleteForm', data)
        .then(res => {
          resolve(res);
        })
        .catch(err => {
          reject(err);
        });
    });
  }
  /* 根据id获取信息 */
  static getItemInfo(data) {
    return new Promise((resolve, reject) => {
      api
        .get('/api/ModelDetail/GetFormJson', data)
        .then(res => {
          resolve(res);
        })
        .catch(err => {
          reject(err);
        });
    });
  }
}

export default Api;
